package cn.iocoder.yudao.module.exam.dal.mysql.questionoption;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.exam.dal.dataobject.questionoption.QuestionOptionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.exam.controller.admin.questionoption.vo.*;

/**
 * 试题选项 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface QuestionOptionMapper extends BaseMapperX<QuestionOptionDO> {

    default PageResult<QuestionOptionDO> selectPage(QuestionOptionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<QuestionOptionDO>()
                .eqIfPresent(QuestionOptionDO::getQuestionId, reqVO.getQuestionId())
                .eqIfPresent(QuestionOptionDO::getOptionText, reqVO.getOptionText())
                .eqIfPresent(QuestionOptionDO::getOptionUrl, reqVO.getOptionUrl())
                .eqIfPresent(QuestionOptionDO::getCorrected, reqVO.getCorrected())
                .betweenIfPresent(QuestionOptionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(QuestionOptionDO::getVersion, reqVO.getVersion())
                .orderByDesc(QuestionOptionDO::getId));
    }

}